
package edu.bistu.sim.xwy.blog.Controller.Repository;

import edu.bistu.sim.xwy.blog.domain.BusUser;
import edu.bistu.sim.xwy.blog.domain.CollectInfo;
import edu.bistu.sim.xwy.blog.domain.NewsCom;
import edu.bistu.sim.xwy.blog.domain.NewsInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface CollectInfoRepository extends JpaRepository<CollectInfo,Integer> {
    @Query(value = "select  a from CollectInfo a where a.collct_user_tel.user_tel=:user_tel")
    List<CollectInfo> findAllNewsBytel(@Param("user_tel")String user_tel);

    List<CollectInfo> findAll();
    @Modifying
    @Transactional
    @Query(value = "delete  from CollectInfo a where a.collct_news_id=:collct_news_id")
    void deleteCol(@Param("collct_news_id") NewsInfo collct_news_id);

}
